<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <button id="myButton">点击我</button>
    <button onclick="handleClick()">点handleClick击我</button>
    <script type="module">

        import app from './demo.js';
        const apps = new app();
        console.log(apps, 'mitt');
        function handleClick() {
            apps.emit('myEvent', { key: 'value' });
        }
        apps.on('myEvent', (data) => {
            console.log(data, 'on 接受事件');
        });
        document.getElementById('myButton').addEventListener('click', handleClick);

    </script>

</body>

</html>